import Mock from 'mockjs'
import type { Request } from 'express'
const { Random } = require('mockjs')
export default [
    //用户登录
    {
        methods: 'post',
        url: '/api/login',
        response: () => ({
            code: 0,
            msk: 'ok',
            data: {
                uid: 100,
                username: '张三',
                token: 'feiidkxkxjksjx'
            }
        })
    },
    //预定用户列表
    {
        methods: 'get',
        url: '/api/register',
        response: (req: Request) => {
            let currentPage = req.query.currentPage ? Number(req.query.currentPage) : 1
            let pageSize = req.query.pageSize ? Number(req.query.pageSize) : 10
            let total = 50
            const data = Mock.mock({
                'usersdata|10': [
                    {
                        'id|+1': currentPage * pageSize + 1,
                        "name": '@cname()',
                        'jzid': /50009090\d{2}/,
                        sfzid: /\d{17}[0-9Xx]|\d{15}/,
                        sjid: /(13\d|14[579]|15[^4\D]|17[^49\D]|18\d)\d{8}/,
                        ghks: '内科-肾内科',
                        ghlx: '专家号',
                        ghf: /\d{2}/,
                        ghzt: '@pick(["已就诊", "未就诊"])',
                        "jzrq": '@date("yyyy-MM-dd")',
                        "hzsj": '@datetime("HH:mm")',
                        yysj: '@datetime("y-MM-dd HH:mm:ss")',
                        cz: ''
                    }]
            })
            return {
                code: 0,
                msk: 'ok',
                data: {
                    ...data,
                    total: total
                }
            }
        }
    },
    //查询预定用户列表
    {
        methods: 'post',
        url: '/api/registerc',
        response: (req: Request) => {
            let currentPage = req.query.currentPage ? Number(req.query.currentPage) : 1
            let pageSize = req.query.pageSize ? Number(req.query.pageSize) : 10
            let total = 50
            const data = Mock.mock({
                'usersdata|10': [
                    {
                        'id|+1': currentPage * pageSize + 1,
                        "name": '@cname()',
                        'jzid': /50009090\d{2}/,
                        sfzid: /\d{17}[0-9Xx]|\d{15}/,
                        sjid: /(13\d|14[579]|15[^4\D]|17[^49\D]|18\d)\d{8}/,
                        ghks: '内科-肾内科',
                        ghlx: '专家号',
                        ghf: /\d{2}/,
                        ghzt: '@pick(["已就诊", "未就诊"])',
                        "jzrq": '@date("yyyy-MM-dd")',
                        "hzsj": '@datetime("HH:mm")',
                        yysj: '@datetime("y-MM-dd HH:mm:ss")',
                        cz: ''
                    }]
            })
            return {
                code: 0,
                msk: 'ok',
                data: {
                    ...data,
                    total: total
                }
            }
        }
    },
    // 批量上传用户
    {
        methods: 'post',
        url: '/api/user/batchAddUser',
        response: (req: Request) => {
            let currentPage = req.query.currentPage ? Number(req.query.currentPage) : 1
            let pageSize = req.query.pageSize ? Number(req.query.pageSize) : 10
            let total = 50
            const data = Mock.mock({
                'usersdata|10': [
                    {
                        'id|+1': currentPage * pageSize + 1,
                        "name": '@cname()',
                        'jzid': /50009090\d{2}/,
                        sfzid: /\d{17}[0-9Xx]|\d{15}/,
                        sjid: /(13\d|14[579]|15[^4\D]|17[^49\D]|18\d)\d{8}/,
                        ghks: '内科-肾内科',
                        ghlx: '专家号',
                        ghf: /\d{2}/,
                        ghzt: '@pick(["已就诊", "未就诊"])',
                        "jzrq": '@date("yyyy-MM-dd")',
                        "hzsj": '@datetime("HH:mm")',
                        yysj: '@datetime("y-MM-dd HH:mm:ss")',
                        cz: ''
                    }]
            })
            return {
                code: 0,
                msk: 'ok',
                data: {
                    ...data,
                    total: total
                }
            }
        }
    },
    //医院导航列表
    {
        methods: 'get',
        url: '/api/hospital/yrdh',
        response: (req: Request) => {
            let currentPage = req.query.currentPage ? Number(req.query.currentPage) : 1
            let pageSize = req.query.pageSize ? Number(req.query.pageSize) : 10
            let total = 50
            const data = Mock.mock({
                'usersdata|10': [
                    {
                        'id|+1': currentPage * pageSize + 1,
                        yq: '@pick(["东院", "湘潭分院","北院"])',
                        dz: '北京市大兴区**路990号',
                        tel1: /021-\d{7}[0-9]/,
                        tel2: /022-\d{7}[0-9]/,
                        gj: '市内乘4、20、24、49、46路可直达东茅岭院本部',
                        czsj: '@date("yyyy-MM-dd")' + ' ' + '@datetime("HH:mm")',
                        cz: ''
                    }]
            })
            return {
                code: 0,
                msk: 'ok',
                data: {
                    ...data,
                    total: total
                }
            }
        }
    },
    //删除指定id的信息
    {
        methods: 'del',
        url: '/api/hospital/yrdh/:id',
        response: (req: Request) => {
            return {
                code: 0,
                msk: 'ok',
            }
        }
    },
    // 选中删除用户
    {
        methods: 'post',
        url: '/api/hospital/yrdh/deleteall',
        response: (req: Request) => {
            return {
                code: 0,
                msk: 'ok',
            }
        }
    },
    // 批量添加用户数据
    {
        methods: 'post',
        url: '/api/hospital/yrdh/batchAddUser',
        response: (req: Request) => {
            return {
                code: 0,
                msk: 'ok',
            }
        }
    },
    // 根据id返回对应用户信息
    {
        methods: 'get',
        url: '/api/hospital/yrdh/addAll/:id',
        response: (req: Request) => {
            const data = Mock.mock({
                'usersdata': [
                    {
                        'id|+1': 55,
                        yq: '@pick(["东院", "湘潭分院","北院"])',
                        dz: '北京市大兴区**路990号',
                        tel1: /021-\d{7}[0-9]/,
                        tel2: /022-\d{7}[0-9]/,
                        gj: '市内乘4、20、24、49、46路可直达东茅岭院本部',
                        czsj: '@date("yyyy-MM-dd")' + ' ' + '@datetime("HH:mm")',
                        cz: ''
                    }]
            })
            return {
                code: 0,
                msk: 'ok',
                data: {
                    ...data,
                }
            }
        }
    },

    // 根据用户id来修改对应用户记录
    {
        methods: 'get',
        url: '/api/hospital/yrdh/edit/:id',
        response: (req: Request) => {
            return {
                code: 0,
                msk: 'ok',
            }
        }
    },
    //添加庭院信息
    {
        methods: 'post',
        url: '/api/yrdh/Counrtyard',
        response: (req: Request) => {
            return {
                code: 0,
                msk: 'ok',
            }
        }
    },
    //根据庭院id获取庭院info
    {
        methods: 'get',
        url: '/api/yrdh/Counrtyard/:id',
        response: (req: Request) => {
            const data = Mock.mock({
                'usersdata': [
                    {
                        yqname: '@pick(["东院", "湘潭分院","北院"])',
                        tel: /021-\d{7}[0-9]/,
                        gj: '市内乘4、20、24、49、46路可直达东茅岭院本部',
                        yndz: ["beijing", "changping", "shahe"],
                        avatar: 'http:xxx.com',
                        ynstate:false
                    }]
            })
            return {
                code: 0,
                msk: 'ok',
                data: {
                    ...data,
                }
            }
        }
    },

]